package main

import (
	"fmt"
	"log"
	"os/exec"
)

func main() {
	// 创建命令（以 git clone 为例）
	// 创建带超时的上下文（适当延长超时时间）
	//ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	//defer cancel()
	cmd := exec.Command("git", "clone", "--progress", "http://1.14.125.6:3000/liuyuchao/runner-test.git")
	//cmd := exec.Command("git clone http://1.14.125.6:3000/liuyuchao/runner-test.git")
	//cmd := exec.CommandContext(ctx, "git", "-c", "core.quotepath=false", "clone", "http://1.14.125.6:3000/liuyuchao/runner-test.git")

	// 执行命令并获取输出
	output, err := cmd.CombinedOutput()
	if err != nil {
		log.Fatalf("命令执行失败: %v\n输出: %s", err, string(output))
	}

	// 打印结果
	fmt.Printf("命令执行成功\n输出:\n%s", string(output))
}
